import {View, ScrollView} from "@tarojs/components";
import React, {useEffect, useState} from "react";
import {ExpressModel} from "@/common/apis/model";
import {getExpress} from "@/common/apis/home_datasource";
import LogUtils from "@/utils/log";
import {Cell, Empty, Button} from "@antmjs/vantui";
import Utils from "@/utils/common";

definePageConfig({
  navigationBarTitleText: '申请列表'
})

export default function ResearchApplyList() {
  const [items, setItems] = useState<ExpressModel[]>()
  useEffect(() => {
    getExpress().then((res) => {
      setItems(res)
    })
    return () => {
      LogUtils.info("ResearchApplyList", "ResearchApplyList")
    }
  }, []);

  return (
    <View style={{
      overflow: 'hidden',
      position: 'relative',
      height: '100VH',
    }}
    >
      <ScrollView
        scrollY // Enable vertical scrolling
        style={{height: '100%', boxSizing: 'border-box'}}
      >
        {items && !Utils.isEmpty(items) ? items.map((e, i) => {
          return <View key={e.code}>
            <Cell title={e.name} renderExtra={<View
              style={{display: 'flex', flexDirection: 'row'}}
            ><Button size={'mini'} type={'info'}>同意</Button><Button plain hairline type="info" size={'mini'}>
              拒绝
            </Button></View>}/>
          </View>
        }) : <Empty description='暂无数据'/>}
      </ScrollView>
    </View>
  )
}


